package com.cory.admin.sys.core.handle;

import java.io.Serializable;
import java.util.Map;
import lombok.Data;
import com.cory.admin.sys.config.AdminConfig;
import com.cory.boot.utils.SpringUtils;
import com.google.common.collect.Maps;

/**
 * @author xiongcong
 * @date 2022-04-16
 */
public interface SystemHandle {

    SystemSession systemSession();
    
    class DefaultSystemHandle implements SystemHandle {
        @Override
        public SystemSession systemSession() {
            AdminConfig config = SpringUtils.getBean(AdminConfig.class);
            SystemSession systemSession = new SystemSession();
            systemSession.sysName = config.getSysName();
            
            return systemSession;
        }
    }
    
    @Data
    class SystemSession implements Serializable {
        private static final long serialVersionUID = 1L;
        
        private String system;
        
        private String sysName;
        
        private String indexCode;
        
        private Map<String, Object> extraInfo = Maps.newHashMap();
    }
}
